package com.example.demo.controller.dxy;

import com.example.demo.entity.User;
import com.example.demo.service.dxy.IUserService;
import com.example.demo.service.dxy.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * author:daixiaoyi
 */

@Slf4j
@Api("课程管理")
@RestController
@RequestMapping(value = "/ceshi")
public class UserController {
    @Autowired
    IUserService iUserService;
    @RequestMapping(value = "/findUserAll",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "全查")
    public List<User> findUserAll(){
         List<User> allUser = iUserService.findUserAll();
        return allUser;
    }
    @ResponseBody
    @RequestMapping(value = "/addUser",method = RequestMethod.POST)
    @ApiOperation(value = "增加")
    public int addUserInfo(String id,String username,String password,String birthday,String photo,String introduce,String usertype){
        int addUserInfo =iUserService.addUserInfo(id,username,password,birthday,photo,introduce,usertype);
        return addUserInfo;

    }
    @ResponseBody
    @RequestMapping(value = "/deleteUser",method = RequestMethod.POST)
    @ApiOperation(value = "删除")
    public int deleteUserInfo(String id){
        int deleteUserInfo=iUserService.deleteUserInfo(id);
        return deleteUserInfo;

    }
    @ResponseBody
    @RequestMapping(value = "/updeteUserInfo",method = RequestMethod.POST)
    @ApiOperation(value = "修改")
    public int updeteUserInfo(String id,String username,String password,String birthday,String photo,String introduce,String usertype) {
        int updeteUserInfo = iUserService.updeteUserInfo(id,username,password,birthday,photo,introduce,usertype);
        return updeteUserInfo;
    }
}
